<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <title>登录页面</title>

  <link rel="stylesheet" href="../css/style.css">
</head>
<body>
  <div class="box">
      <span class="divline"></span>
      <form action="#">
          <h2>登录</h2>
          <div class="input-box">
              <input  type="text"  required>
              <span>用户名</span>
              <i></i>
          </div>

          <div class="input-box">
              <input  type="password" required>
              <span>密码</span>
              <i></i>
          </div>
          <div class="links">
              <a href="#">忘记密码？</a>
              <a href="#">注册</a>
          </div>
          <input type="submit" value="登录">
      </form>

  </div>

<script>

</script>

<style> 
  * {
  padding: 0;
  margin: 0;
  box-sizing: border-box;
  font-family: 'Poppins',sans-serif;
}

body {
  display: flex;
  justify-content: center;
  align-items: center;
  min-height: 100vh;
  background-color: #23242a;
}


.box {
  width: 380px;
  height: 420px;
  position: relative;
  background-color: #1c1c1c;
  border-radius: 8px;
  overflow: hidden;
}


.box::before {
  content: '';
  position: absolute;
  width: 380px;
  height: 420px;
  left: -50%;
  top:-50%;
  background: linear-gradient(0deg,transparent,transparent,#ff2770,#ff2770,#ff2770);
  z-index: 1;
  animation: animate 6s linear infinite;
  transform-origin: bottom right;
}

.box::after {
  content: '';
  position: absolute;
  width: 380px;
  height: 420px;
  left: -50%;
  top:-50%;
  background: linear-gradient(0deg,transparent,transparent,#ff2770,#ff2770,#ff2770);
  z-index: 1;
  animation: animate 6s linear infinite;
  transform-origin: bottom right;
  animation-delay: -3s;
}

@keyframes animate {
  from{
      transform: rotate(0deg);
  }

  to{
      transform: rotate(360deg);
  }
}

/* .divline {
  position: absolute;
  top: 0;
  inset: 0;

}

.divline::after {
  content: '';
  position: absolute;
  width: 380px;
  height: 420px;
  left: -50%;
  top:-50%;
  background: linear-gradient(0deg,transparent,transparent,#27ff85,#27ff85,#27ff85);
  z-index: 1;
  animation: animate 6s linear infinite;
  transform-origin: bottom right;
  animation-delay: -1.5s;
}

.divline::before {
  content: '';
  position: absolute;
  width: 380px;
  height: 420px;
  left: -50%;
  top:-50%;
  background: linear-gradient(0deg,transparent,transparent,#27ff85,#27ff85, #27ff85);
  z-index: 1;
  animation: animate 6s linear infinite;
  transform-origin: bottom right;
  animation-delay: -4.5s;

} */


.box form {
  position: absolute;
  inset: 2px;
  border-radius: 8px;
  background-color: #222;
  padding: 50px 40px;
  z-index: 2;
  display: flex;
  flex-direction: column;
}



.box form h2{
  color: white;
  font-weight: 500;           /*字体粗细*/
  letter-spacing: .1rem;      /*控制字体间隔为根元素的十分之一*/
  text-align: center;
}


.box form .input-box {
  position: relative;
  width: 300px;
  margin-top: 35px;
}

.input-box input {
  position: relative;
  border: none;
  outline: none;
  background: transparent;
  padding: 20px 10px 10px;
  width: 100%;
  box-shadow: none;
  color: #23242a;
  z-index: 10;
  font-size: 1rem;
  letter-spacing: 0.05rem;
  transition: .5s;
}

.input-box span {
  color: #8f8f8f;
  font-size: 1rem;
  position: absolute;
  left:0;
  padding: 20px 0 10px;
  transition: .5s;
  letter-spacing: 0.05rem;
  pointer-events: none;
}

.input-box input:valid~span,
.input-box input:focus~span {
  font-size:0.75rem;
  transform: translateY(-34px);
  color: white;

}

.input-box i{
  position: absolute;
  left:0;
  bottom: 0;
  height: 2px;
  background-color: white;
  width: 100%;
  border-radius: 4px;
  pointer-events: none;
  overflow: hidden;
  transition: .5s;
}

.input-box input:valid~i,
.input-box input:focus~i {
  height: 44px;

}

.links {
  display: flex;
  flex-direction: row;
  justify-content: space-between;
  margin: 10px 0;
}

.links a {
  text-decoration: none;
  font-size: 0.65rem;
  color: #8f8f8f;
  letter-spacing: 0.01rem;
  transition: 0.3s;
}

.links a:hover,
.links a:nth-child(2) {
  color: white;
}

form input[type="submit"] {
  width: 100px;
  border-radius: 4px;
  outline: none;
  border: none;
  background-color: white;
  padding: 9px 25px;
  cursor: pointer;
  font-size: 0.9rem;
  margin-top: 10px;
  transition: .1s;

}



/*----------------------------*/
/*.input-box {
  position: relative; !* 确保子元素可以使用绝对定位 *!
  padding-bottom: 10px; !* 为下划线留出空间 *!

}

.input-box i {
  position: absolute;
  left: 0;
  bottom: 0;
  height: 2px;
  width: 0; !* 初始宽度为0 *!
  background-color: white;
  transition: width 0.3s ; !* 平滑过渡宽度变化 *!
}

.input-box i:before {
  content: ''; !* 必须设置content属性 *!
  position: absolute;
  left: 0;
  bottom: 0;
  height: 2px;
  width: 100%; !* 初始宽度为100% *!
  background-color: #ff6f95; !* 设置颜色 *!
  transition: width 0.3s ease, background-color 0.3s ease; !* 平滑过渡宽度和背景颜色变化 *!
}

!* 当.input-box获得焦点时改变<i>和<i:before>的样式 *!
.input-box:focus-within i,
.input-box:hover i {
  width: 100%; !* <i>标签的宽度变为100% *!
}

.input-box:focus-within i:before,
.input-box:hover i:before {
  width: 0; !* <i:before>的宽度变为0 *!
  background-color: white; !* 改变背景颜色 *!
}

.input-box input {
  color: white;
}*/
</style>

</body>
</html>